package com.hspedu.socket;

import java.io.IOException;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/3/2
 * @time 16:15
 */
public class SocketTCP02Server {
    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(8888);

        Socket socket = serverSocket.accept();
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("客户端你好，这里是服务器~".getBytes());

        outputStream.close();
        socket.close();
        serverSocket.close();
    }
}
